import os
from collections import namedtuple


class CodeartsConfig:
    REGION = "cn-north-4"  # 北京四
    DOMAIN_NAME = "Campaign_Mgmt_2012"
    IAM_USER_NAME = "Campaign_Mgmt_2012"
    PROJECT_ID = "089220b53fa540198192cad8383cc5ab"  # 持续集成管理系统项目id
    if os.getenv("pipeline_id"):
        PIPELINE_ID = os.getenv("pipeline_id")    # Omni-Infer-Gate流水线id
    else:
        PIPELINE_ID = "2030fd35805646e88c059c3371eb003e"


class GiteeConfig:
    URL_ROOT = "https://gitee.com/api/v5/repos/"
    if os.getenv("repo_url"):
        # 这里使用strip会把/t当成转义符误处理
        repo_url = os.getenv("repo_url").replace("https://gitee.com/", "").replace(".git", "").split("/")
        REPO_OWNER = repo_url[0]
        REPO_NAME = repo_url[-1]
    else:
        REPO_OWNER = "taishanmayi"
        REPO_NAME = "omniinfer"

    # TOKEN = "37010ebdc836b83f466b01517c73ed2e"
    TOKEN = "57eb0f34bb053d096eb705070bc26226"


# {codearts job名称：[gitee评论显示名称, 门禁检查项名称]}
CiJobInfo = namedtuple("CiJobInfo", ["report_name", "ci_check_item_name", "jenkins_job_name"])
NEED_REPORT_CI_JOBS = {"BUILD": {"Build": CiJobInfo(report_name="构建", ci_check_item_name="ci_build", jenkins_job_name="omni_gate_build_image")},
                       "LLT": {
                           #"CodeCheck代码检查": CiJobInfo(report_name="代码检查", ci_check_item_name="ci_codecheck"),
                               #"Virus_Scan": CiJobInfo(report_name="病毒扫描", ci_check_item_name="ci_virus_scan"),
                               #    "Flaw_Scan": CiJobInfo(report_name="漏洞扫描", ci_check_item_name="ci_flaw_scan"),
                               "UT": CiJobInfo(report_name="UT", ci_check_item_name="ci_UT", jenkins_job_name="omni_gate_UT_test"),
                               # "Mock_Model": CiJobInfo(report_name="冒烟", ci_check_item_name="ci_smoke")
                               },
                       "SMOKE": {"SMOKE": CiJobInfo(report_name="冒烟", ci_check_item_name="ci_smoke", jenkins_job_name="omni_gate_smoke")}
                       }
